using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace WebManager.Manager.Group
{
    public partial class ListGroup : System.Web.UI.Page
    {
        private LYQ.BLL.S_Group sGroupBll = new LYQ.BLL.S_Group();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                GridView1.DataSource = sGroupBll.GetList("").Tables[0];
                GridView1.DataBind();
            }
        }

        protected void NewUser_Click(object sender, EventArgs e)
        {
            string url = URLUtility.UrlBase + @"/WebManager/manager/Group/NewGroup.aspx";
            Page.Response.Redirect(url);
        }

        protected void EditUser_Click(object sender, EventArgs e)
        {
            if (HttpContext.Current.Request.Form["selectCB"] == null) return;
            string[] sel = Request.Form["selectCB"].Split(',');            

            string url = URLUtility.UrlBase + @"/WebManager/manager/Group/EditGroup.aspx?GID=" + sel[0];
            Page.Response.Redirect(url);

        }

        protected void DeleteUser_Click(object sender, EventArgs e)
        {
            if (HttpContext.Current.Request.Form["selectCB"] == null) return;
            string[] sel = Request.Form["selectCB"].Split(',');

            LYQ.BLL.S_Group bll = new LYQ.BLL.S_Group();
            bll.Delete(sel[0]);

            string url = URLUtility.UrlBase + @"/WebManager/manager/Group/ListGroup.aspx";
            Page.Response.Redirect(url);

        }
    }
}
